 <?php
 include_once(CORE_PATH.'classes/phpmailer/class.phpmailer.php');
 class SendMailer extends phpmailer
	{
		public function SendEmailHMTL($sFrom,$sBody,$sEmail,$sName)
		{
//            $mail->SetFrom($from, $from_name);
//            $mail->Subject = $subject;
//            $mail->Body = $body;
//            $mail->AddAddress($to);
//            if(!$mail->Send()) {
//                $error = 'Gởi mail bị lỗi: '.$mail->ErrorInfo;
//                return false;
//            } else {
//                $error = 'thư của bạn đã được gởi đi ';
//                return true;
//            }

//			try
//			{
				$this->SetFrom($sFrom,"tui ne");		//Dia chi mail va ten nguoi gui
				$this->Subject ='Lấy lại mật khẩu';				//tieu de mail						
				//$this->AltBody   = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
				//////$this->MsgHTML($sBody);
                $this->Body = $sBody;
                $mail->AddAddress('trongtayninh@yahoo.com');
				///$this->SearchSearchress($sFrom);
				//$this->SearchCC($sEmail, $sName);                // mail và tên người nhận mail
				if(!$this->Send())
				{
					throw new Exception("Could not send the email.  ");
					return false;		
				}	
				else
				{
					return true;
				}
//			}
//			catch(Exception $e)
//			{
//			  throw $e;
//			}
			return false;	
		}
		
		function SendMailer()
		{
		
			$this->IsSMTP(); 							// telling the class to use SMTP
			$this->Host       = "smtp.gmail.com"; 		// SMTP server
			$this->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
													   // 1 = errors and messages
													   // 2 = messages only
			$this->SMTPAuth   = true;                  // enable SMTP authentication
			$this->IsHTML(true);
			$this->SMTPSecure = "ssl";                 // sets the prefix to the servier
			$this->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
			$this->Port       = 465;                   // set the SMTP port for the GMAIL server
			$this->Username   = "trongseo@gmail.com";  //  username
			$this->Password   = "tinhgia!11";
			$this->CharSet = 'UTF-8';
		} 
	}
	
?>	